Many current operating systems provide a mechanism called “signals”. This is a software feature that is similar to interrupts in the hardware environment. A program or operating system sends the signals to interrupt an application program, in order to notify the application program of an event.
Such interruptions (signals) usually take the form of a forced asynchronous procedure call that handles whatever tasks are required by the interruption. The specific function called is designated in advance by the interrupted program.
In the absence of a handler function, the interrupted program is usually aborted.
Programs may be performing delicate operations that should be completed and not interrupted by the signals until the delicate operation(s) is completed. Because the exact arrival time of each signal is usually not predictable, programs need a mechanism to hold off delivery of signals until certain delicate operations (that would be disturbed by an incoming signal) can be completed. This mechanism is known as “signal blocking” or “signal masking”.
It is common for a program to enter and leave critical regions of code frequently. A critical region is a sequence of instructions that is executed by a process (thread) in a program without interference so that the process can atomically manipulate shared data. As a result, signal masking and unmasking (i.e., re-enabling of reception of the signal) are required to be fast, or overall program throughput will become limited.
In current systems, the program establishes and disables signal masks via a system call (i.e., by calling the operating system on both entry to and exit from every critical region, each and every time that the entry or exit is performed). The most common technique for speeding up this process is to supply special system calls that have been tuned for speed. However, since the operating system is still called on entry and exit of each critical region, overall program performance is still limited unnecessarily.
In some programs, signal masking and unmasking may occur, for example, about 100 to 1000 times per seconds, and this leads to inefficiency in programs because the large amount of masking and unmasking is time-consuming and a signal may not have been received when the masking and unmasking is performed. For example, the ratio of performing masking/unmasking and actually receiving a signal is typically 1,000-to-1 to 1,000,000-to-1 or more in some programs.
Therefore, there is a continuing need to improve and enhance the performance (e.g., speed) of current methods to mask and unmask the signals.